<template>
  <div class="app">
    <div class="header">
      <van-nav-bar :title="title" style="" v-if="isHeaderRightShow">
        <template #left>
          <van-icon name="arrow-left" size="18" color="#FFFFFF" />
        </template>
        <template #right>
          <van-icon name="share-o" size="18" color="#FFFFFF" />
        </template>
      </van-nav-bar>
      <van-nav-bar :title="title" style="" v-else>
        <template #left>
          <van-icon name="arrow-left" size="18" color="#FFFFFF" />
        </template>
      </van-nav-bar>
    </div>
    <div class="main">
      <keep-alive v-if="$route.meta.keepAlive">
         <router-view/>
      </keep-alive>
      <router-view v-else />
    </div>
    <div class="footer">
      <keep-alive v-if="$route.meta.keepAlive">
         <router-view/>
      </keep-alive>
      <router-view v-else />
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  computed:{
    ...mapState(['isHeaderRightShow', 'title'])
  }
}
</script>
<style lang="scss">
html,
body,
.app{
  height: 100%;
  background: #fafafa;
}
.app {
  display: flex;
  flex-direction: column;
}
.main {
  flex: 1;
  overflow-x: hidden;
}
.header {
  .van-nav-bar .van-icon, .van-nav-bar__title {
    color: white;
  }
  .van-nav-bar__text {
    color: #fff;
  }
  .van-nav-bar {
    background: #53CA9A;
  }
}
html,
body,
p,
ol,
ul,
li,
dl,
dt,
dd,
blockquote,
figure,
fieldset,
legend,
textarea,
pre,
iframe,
hr,
h1,
h2,
h3,
h4,
h5,
h6,
article,
aside,
details,
figcaption,
footer,
header,
hgroup,
menu,
nav,
section {
  margin: 0;
  padding: 0;
}
/* Headings */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-size: 100%;
  font-weight: normal;
}
/* List */
ul {
  list-style: none;
}
/* Form */
button,
input,
select,
textarea {
  margin: 0;
}
/* Box sizing */
*,
*:before,
*:after {
  box-sizing: inherit;
}
/* Media */
embed,
iframe,
object,
video {
  height: auto;
  max-width: 100%;
}
audio {
  max-width: 100%;
}
/* Iframe */
iframe {
  border: 0;
}
/* Table */
table {
  border-collapse: collapse;
  border-spacing: 0;
}
td,
th {
  padding: 0;
  text-align: left;
}
a {
  text-decoration: none;
  outline: none;
}
.footer {
  height: 50px;
}
</style>
